package com.adong.dao;

import com.adong.pojo.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author com.adong
 */
@Repository
public class BookDaoImpl implements BookDao {
    //将配置文件中对象注入
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void add(Book book) {
        String sql ="insert into t_book values(?,?,?)";
        jdbcTemplate.update(sql, book.getUserid(), book.getUsername(), book.getUstatus());

    }

    @Override
    public void delete(Integer id) {
        String sql ="delete from t_book where userid = ?";
        jdbcTemplate.update(sql,id);
    }
}
